package com.boc.ewr.bcimp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.boc.ewr.bcimp.entity.Pro;
import com.boc.ewr.bcimp.mapper.ProMapper;
import com.boc.ewr.bcimp.service.IProService;
import com.boc.ewr.util.file.enumeration.SignTypeEnum;
import org.jeecg.common.mybatis.query.QueryWrapperX;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Date;
import java.util.List;
import java.util.PriorityQueue;

/**
 * @Description: 协议清单
 * @Author: jeecg-boot
 * @Date: 2023-04-20
 * @Version: V1.0
 */
@Service
public class ProServiceImpl extends ServiceImpl<ProMapper, Pro> implements IProService {

    @Autowired
    private ProMapper proMapper;

    @Override
    public List<Pro> getUnSignAcct(Date date) {
        LambdaQueryWrapper<Pro> proWrapper = new LambdaQueryWrapper<Pro>();
        proWrapper.eq(Pro::getSingedType, SignTypeEnum.UNSIGNED.getIndex());
        if (date != null) {
            proWrapper.le(Pro::getSingedDate, date);
        }
        return proMapper.selectList(proWrapper);
    }

    @Override
    public List<Pro> getSignedAddrEpt() {
        LambdaQueryWrapper<Pro> proWrapper = new LambdaQueryWrapper<Pro>();
        proWrapper.isNotNull(Pro::getLinkerName)
                // 地址为null
                .isNull(Pro::getAddr)
                .or()
                // 地址为空
                .eq(Pro::getAddr,"");
        return proMapper.selectList(proWrapper);
    }
}
